import os

def generateAdd(Number):
    try:
        address = open("./"+"generateList.txt","a")
    except IOError:
        print('NEW generateList.txt ERROR')
    else:
        for num in range(1,Number + 1):
            address.writelines("http://127.0.0.1:5000/txt/"+str(num)+".txt \n")
            print("ADD http://127.0.0.1:5000/txt/"+str(num)+".txt  ---------OK\n")

def generateContent(Number):
    for i in range(1, Number+1):
        try:
            address = open("./txt/"+str(i)+".txt","a")
        except IOError:
            print('NEW '+ str(i) +'.txt ERROR')
        else:
            address.writelines(str(i) +"\n")
            print('ADD '+ str(i) +'.txt   ---------OK\n')


if __name__ == "__main__":
    number = int(input('Enter GenerateList Number:'))
    generateAdd(number)
    generateContent(number)